<?php

/**
 * ProveedorInternacional filter form base class.
 *
 * @package    dirsac
 * @subpackage filter
 * @author     Miguel Flores
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseProveedorInternacionalFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'pais_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Pais'), 'add_empty' => true)),
      'nombre'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'rut'               => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'giro'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'telefono'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'direccion_web'     => new sfWidgetFormFilterInput(),
      'calle'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'numero'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nombre_contacto'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'correo_contacto'   => new sfWidgetFormFilterInput(),
      'telefono_contacto' => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'pais_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Pais'), 'column' => 'id')),
      'nombre'            => new sfValidatorPass(array('required' => false)),
      'rut'               => new sfValidatorPass(array('required' => false)),
      'giro'              => new sfValidatorPass(array('required' => false)),
      'telefono'          => new sfValidatorPass(array('required' => false)),
      'direccion_web'     => new sfValidatorPass(array('required' => false)),
      'calle'             => new sfValidatorPass(array('required' => false)),
      'numero'            => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'nombre_contacto'   => new sfValidatorPass(array('required' => false)),
      'correo_contacto'   => new sfValidatorPass(array('required' => false)),
      'telefono_contacto' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('proveedor_internacional_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'ProveedorInternacional';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'pais_id'           => 'ForeignKey',
      'nombre'            => 'Text',
      'rut'               => 'Text',
      'giro'              => 'Text',
      'telefono'          => 'Text',
      'direccion_web'     => 'Text',
      'calle'             => 'Text',
      'numero'            => 'Number',
      'nombre_contacto'   => 'Text',
      'correo_contacto'   => 'Text',
      'telefono_contacto' => 'Text',
    );
  }
}
